CPPFLAGS+=-g -O2 -I../..
LDLIBS+=
LIB_DIR=..
LIBS.cpp=\
	$(LIB_DIR)/../DebugNew.cpp\
	$(LIB_DIR)/../MemoryLeak.cpp
LIB_OBJECTS=$(LIBS.cpp:.cpp=.o)

SOURCE_DIR=..
SIMPLE_TEST.cpp=\
	$(SOURCE_DIR)/simple_test.cpp
SIMPLE_TEST_OBJECTS=$(SIMPLE_TEST.cpp:.cpp=.o)

ALL_TEST.cpp=\
	$(SOURCE_DIR)/basic_test.cpp\
	$(SOURCE_DIR)/other_test.cpp\
	$(SOURCE_DIR)/stl_test.cpp\
	$(SOURCE_DIR)/all_test.cpp
ALL_TEST_OBJECTS=$(ALL_TEST.cpp:.cpp=.o)

all:
	make all_test
	make simple_test

all_test: $(LIB_OBJECTS) $(ALL_TEST_OBJECTS)
	g++ -o all_test $(LIB_OBJECTS) $(ALL_TEST_OBJECTS) $(LDLIBS)

simple_test: $(LIB_OBJECTS) $(SIMPLE_TEST_OBJECTS)
	g++ -o simple_test $(LIB_OBJECTS) $(SIMPLE_TEST_OBJECTS) $(LDLIBS)

#$(TARGET): $(LIB_OBJECTS) $(ALL_OBJECTS)

.cpp.o: $<
	g++ $(CPPFLAGS) -c $< -o $@

clean:
	rm -rf all_test all_test.exe
	rm -rf simple_test simple_test.exe
	rm -rf $(LIB_OBJECTS)
	rm -rf $(SIMPLE_TEST_OBJECTS)
	rm -rf $(ALL_TEST_OBJECTS)